/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef OHCRYPTO_SIGNATURE_TEST_H
#define OHCRYPTO_SIGNATURE_TEST_H

#include "crypto_common.h"
#include "crypto_signature.h"
#include "crypto_asym_key.h"
#include "crypto_framework_common_test.h"

typedef struct {
    uint8_t *algoName;
    uint8_t *asymAlgoName;
    int32_t msgLen;
} SignSpec;

typedef struct {
    uint8_t *signAlgoName;
    uint8_t *verifyAlgoName;
    uint8_t *asymAlgoName;
    uint8_t *digestAlgoName;
    int32_t msgLen;
} OnlySignSpec;

typedef struct {
    uint8_t *algoName;
    uint8_t *asymAlgoName;
    uint8_t *digestAlgoName;
    int32_t msgLen;
} AsymSignSpec;

#define SKIP_NOHASH_TEST(value)                         \
    if (strlen(value) == strlen("NoHash") && memcmp(value, "NoHash", strlen("NoHash")) == 0) \
        return

#define SKIP_ED25519_TEST(value)                         \
if (strlen(value) == strlen("Ed25519") && memcmp(value, "Ed25519", strlen("Ed25519")) == 0)    \
    return

static uint8_t g_rsa_512_priKey[] = {
    0x30, 0x82, 0x01, 0x3b, 0x02, 0x01, 0x00, 0x02, 0x41, 0x00, 0xb3, 0x61, 0x3c, 0x24, 0xfd, 0x9f,
    0x7e, 0xad, 0x87, 0x36, 0x4d, 0x13, 0xd5, 0x7e, 0xef, 0x04, 0xc4, 0x57, 0xc5, 0x4c, 0x70, 0x5c,
    0x49, 0x90, 0x4f, 0xd6, 0xde, 0x5d, 0x37, 0xc0, 0x23, 0x6e, 0x23, 0xf0, 0x71, 0x64, 0xd8, 0xd7,
    0x16, 0x1e, 0x32, 0x0c, 0xab, 0x0a, 0x76, 0xcd, 0x55, 0x96, 0xe7, 0x85, 0x6c, 0x7e, 0x39, 0x85,
    0x0e, 0x0e, 0x43, 0x25, 0xc8, 0x90, 0x97, 0xe5, 0x40, 0x61, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02,
    0x40, 0x31, 0xd2, 0xb1, 0x1c, 0xe9, 0x21, 0x12, 0xd3, 0x69, 0xf9, 0xe8, 0x20, 0xb9, 0x2c, 0xff,
    0x80, 0x88, 0x74, 0x84, 0x85, 0x7d, 0xb3, 0xf4, 0x6e, 0xd3, 0xee, 0x2f, 0x67, 0x1e, 0xe4, 0x0c,
    0x32, 0xc5, 0x56, 0xb8, 0x20, 0x7f, 0xb7, 0x8e, 0xd5, 0xdc, 0x69, 0x94, 0xed, 0xa2, 0x97, 0xc6,
    0x31, 0x4f, 0x15, 0xe7, 0xe0, 0xf6, 0x10, 0xaa, 0x24, 0xd2, 0x34, 0x51, 0xed, 0x35, 0xe2, 0xfc,
    0x11, 0x02, 0x21, 0x00, 0xd8, 0x40, 0x5c, 0x28, 0xb3, 0x32, 0x7c, 0x8d, 0xdf, 0xba, 0x8d, 0x8d,
    0xc6, 0xe3, 0x1f, 0xb5, 0xd3, 0x4d, 0x3b, 0x78, 0x83, 0x5b, 0x2f, 0x09, 0x4d, 0xcd, 0xd3, 0xf8,
    0xb1, 0x46, 0x61, 0x75, 0x02, 0x21, 0x00, 0xd4, 0x59, 0xe5, 0x01, 0xfb, 0x6c, 0x56, 0x6e, 0xa6,
    0x58, 0x3a, 0x62, 0x7e, 0x4e, 0x87, 0x7d, 0x3c, 0xca, 0x3e, 0x1e, 0x0e, 0x75, 0xcf, 0xcf, 0x4d,
    0x00, 0x07, 0x22, 0xc4, 0x83, 0x79, 0xbd, 0x02, 0x21, 0x00, 0xbe, 0x98, 0xab, 0x21, 0x6c, 0x1f,
    0x59, 0x4c, 0x2a, 0x1e, 0x60, 0x58, 0xcf, 0x2c, 0xab, 0x6c, 0x34, 0x5a, 0x63, 0xca, 0x29, 0xec,
    0x1a, 0x1e, 0xd7, 0x26, 0x4c, 0x67, 0x6a, 0xc7, 0x9f, 0x69, 0x02, 0x20, 0x74, 0x3f, 0x65, 0xfb,
    0xc8, 0xcc, 0xcd, 0x20, 0x33, 0xd6, 0x16, 0xd8, 0x36, 0x76, 0xfc, 0xfb, 0x15, 0x5d, 0x4d, 0xd6,
    0x1c, 0x6a, 0x68, 0x41, 0xfe, 0xd0, 0x26, 0x17, 0xe5, 0x66, 0x68, 0x2d, 0x02, 0x21, 0x00, 0x96,
    0x19, 0x8e, 0xa3, 0xdc, 0x74, 0x7b, 0x2c, 0x3e, 0xe4, 0x5d, 0x78, 0xc9, 0x38, 0x5e, 0xc3, 0x2f,
    0x1f, 0xe2, 0x41, 0x01, 0xaf, 0xfb, 0x56, 0xf7, 0xf9, 0xc9, 0x64, 0x42, 0x38, 0x5a, 0xc3
};

static uint8_t g_rsa_512_pubKey[] = {
    0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
    0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0xb3, 0x61, 0x3c, 0x24, 0xfd, 0x9f, 0x7e,
    0xad, 0x87, 0x36, 0x4d, 0x13, 0xd5, 0x7e, 0xef, 0x04, 0xc4, 0x57, 0xc5, 0x4c, 0x70, 0x5c, 0x49,
    0x90, 0x4f, 0xd6, 0xde, 0x5d, 0x37, 0xc0, 0x23, 0x6e, 0x23, 0xf0, 0x71, 0x64, 0xd8, 0xd7, 0x16,
    0x1e, 0x32, 0x0c, 0xab, 0x0a, 0x76, 0xcd, 0x55, 0x96, 0xe7, 0x85, 0x6c, 0x7e, 0x39, 0x85, 0x0e,
    0x0e, 0x43, 0x25, 0xc8, 0x90, 0x97, 0xe5, 0x40, 0x61, 0x02, 0x03, 0x01, 0x00, 0x01
};

static uint8_t g_rsa_512_pubKey_n[] = {
    0xB3, 0x61, 0x3C, 0x24, 0xFD, 0x9F, 0x7E, 0xAD, 0x87, 0x36, 0x4D, 0x13, 0xD5, 0x7E, 0xEF, 0x04,
    0xC4, 0x57, 0xC5, 0x4C, 0x70, 0x5C, 0x49, 0x90, 0x4F, 0xD6, 0xDE, 0x5D, 0x37, 0xC0, 0x23, 0x6E,
    0x23, 0xF0, 0x71, 0x64, 0xD8, 0xD7, 0x16, 0x1E, 0x32, 0x0C, 0xAB, 0x0A, 0x76, 0xCD, 0x55, 0x96,
    0xE7, 0x85, 0x6C, 0x7E, 0x39, 0x85, 0x0E, 0x0E, 0x43, 0x25, 0xC8, 0x90, 0x97, 0xE5, 0x40, 0x61
};

#endif // OHCRYPTO_SIGNATURE_TEST_H
